package zcjq.d911;

import java.util.*;

public class P1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[] params = Arrays.stream(scanner.nextLine().trim().split("\\s+")).mapToInt(s -> Integer.parseInt(s)).toArray();
        int n = params[0];
        int m = params[1];
        int x = params[2]; // 移动
        int y = params[3]; // 转向
        int z = params[4]; // 敲击

        Map<Character, List<int[]>> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            char[] row = scanner.nextLine().trim().toCharArray();
            for (int j = 0; j < row.length; j++) {
                if (!map.containsKey(row[j])) {
                    map.put(row[j], new ArrayList<>());
                }
                map.get(row[j]).add(new int[]{i, j});
            }
        }
        //计算
        String seq = scanner.nextLine().trim();
        int[] total = new int[]{0, 0, 0};
        for (char c : seq.toCharArray()) {
            int[] result = cost(map.get(c), total[0], total[1], x, y);
            total[0] = result[0];
            total[1] = result[1];
            total[2] += result[2] + z;
        }
        System.out.println(total[2]);
    }

    public static int[] cost(List<int[]> positions, int p_x, int p_y, int x, int y) {
        int[] result = new int[3];
        int cost = Integer.MAX_VALUE;
        for (int[] pos : positions) {
            int lenX = Math.abs(p_x - pos[0]);
            int lenY = Math.abs(p_y - pos[1]);
            int tmp = (lenX + lenY) * x;
            if (lenX != 0 && lenY != 0) {
                tmp += y;
            }
            if (tmp < cost) {
                result[0] = pos[0];
                result[1] = pos[1];
                result[2] = tmp;
                cost = tmp;
            }
        }
        return result;
    }

}
